<script lang="ts">
	import { TUILogin } from '@tencentcloud/tui-core';
	// #ifdef APP-PLUS || H5
	import { TUIChatKit } from './TUIKit';
	TUIChatKit.init();
	// #endif

	let vueVersion = 2;
	// #ifdef VUE3
	vueVersion = 3;
	// #endif

	// Required information
	// You can get userSig from TencentCloud chat console for Testing TUIKit.
	// Deploy production environment please get it from your server.
	// View https://cloud.tencent.com/document/product/269/32688
	
	// uni.$SDKAppID = 1600059338; // Your SDKAppID
	// uni.$userID = 'cs-user1'; // Your userID
	// uni.$userSig = 'eJwtzMEKgkAUheF3mXXJHcfJElqELkJqY1LgTpxxuGiTXJ0KonfP1OX5fjgflp8u3lMTi5jvAVtNG5W2A9Y4cdWvXa*JL61XTdl1qFjENwAgd0Js56LfHZIeXUrpj2nWAe9-CwWE3A8EX17QjNck6HHmRXxLj8GAr2vrWlNUkCUus4ZqVyYQp4dckW327PsD0sszGg__'; // Your userSig
	

	export default { 
		onLaunch: function () {
			const token = uni.getStorageSync('token'); // 请根据实际情况获取 token
			uni.request({
				url:this.$uts + '/api/user/getUser',
				method:'POST',
				header:{
					'Authorization':`${'Bearer'} ${token}`,
					'server':1,
					'token':uni.getStorageSync('token')
				},
				success:res=>{
					console.log(res.data.data,'个人信息');
					let Shuju={
						member_ids:res.data.data.id
					}
					this.$request('/api/index/getImSign',Shuju).then((res)=>{
						console.log(res.data,'Im')
						TUILogin.login({
							SDKAppID: res.data.SDKAppID,
							userID:  res.data.userID,
							userSig:  res.data.userSig,
							useUploadPlugin: true, // If you need to send rich media messages, please set to true.
							framework: `vue${vueVersion}` // framework used vue2 / vue3
						}).catch(() => { });
						
					})
				}
			})
			
			
			
		}
	};
</script>

<style lang="scss">
	@import "@/uni_modules/uview-ui/index.scss";


// uni-page-body,
// 	html,
// 	body,
// 	page {
// 		width: 100% !important;
// 		height: 100% !important;
// 		overflow: hidden;
// 	}
	

	/*每个页面公共css */
	.bfbimages {
		width: 100%;
		height: 100%;
	}

	.flex {
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.ellipsis {
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.ellipsis2 {
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.NoList {
		width: 100%;
		height: 200rpx;
		text-align: center;
		line-height: 200rpx;
		font-size: 28rpx;
		color: #999999;
	}
</style>